package com.eastfair.gateway.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 黑名单
 * </p>
 *
 * @author ligang
 * @since 2022-08-23
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_back_list")
@ApiModel(value = "BackList", description = "黑名单")
@AllArgsConstructor
public class BackList extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 阻止访问ip
     */
    @ApiModelProperty(value = "阻止访问ip")
    @Size(max = 20, message = "阻止访问ip长度不能超过20")
    @TableField(value = "ip", condition = LIKE)
    @Excel(name = "阻止访问ip")
    private String ip;

    /**
     * 阻止访问用户id
     */
    @ApiModelProperty(value = "阻止访问用户id")
    @TableField(value = "user_id")
    @Excel(name = "阻止访问用户id")
    private Long userId;

    /**
     * 阻止访问的身份证号码
     */
    @ApiModelProperty(value = "阻止访问的身份证号码")
    @Size(max = 255, message = "阻止访问的身份证号码长度不能超过255")
    @TableField(value = "id_card", condition = LIKE)
    @Excel(name = "阻止访问的身份证号码")
    private String idCard;

    /**
     * 阻止访问的手机号
     */
    @ApiModelProperty(value = "阻止访问的手机号")
    @Size(max = 16, message = "阻止访问的手机号长度不能超过16")
    @TableField(value = "mobile", condition = LIKE)
    @Excel(name = "阻止访问的手机号")
    private String mobile;

    /**
     * 阻止访问的邮箱
     */
    @ApiModelProperty(value = "阻止访问的邮箱")
    @Size(max = 64, message = "阻止访问的邮箱长度不能超过64")
    @TableField(value = "email", condition = LIKE)
    @Excel(name = "阻止访问的邮箱")
    private String email;

    /**
     * 限制时间起
     */
    @ApiModelProperty(value = "限制时间起")
    @TableField(value = "limit_start")
    @Excel(name = "限制时间起", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime limitStart;

    /**
     * 限制时间止
     */
    @ApiModelProperty(value = "限制时间止")
    @TableField(value = "limit_end")
    @Excel(name = "限制时间止", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime limitEnd;

    /**
     * 限制的系统场景
     */
    @ApiModelProperty(value = "限制的系统场景")
    @Size(max = 255, message = "限制的系统场景长度不能超过255")
    @TableField(value = "system_scene", condition = LIKE)
    @Excel(name = "限制的系统场景")
    private String systemScene;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDeleted;


    @Builder
    public BackList(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    String ip, Long userId, String idCard, String mobile, String email, 
                    LocalDateTime limitStart, LocalDateTime limitEnd, String systemScene, Long tenantId, Long projectId, Integer isEnabled, Integer isDeleted) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.ip = ip;
        this.userId = userId;
        this.idCard = idCard;
        this.mobile = mobile;
        this.email = email;
        this.limitStart = limitStart;
        this.limitEnd = limitEnd;
        this.systemScene = systemScene;
        this.tenantId = tenantId;
        this.projectId = projectId;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
    }

}
